import java.util.*;

/**
 * @author LKQ
 * @date 2022/7/12 9:43
 * @description 计数优化
 */
public class Solution3 {
    public static void main(String[] args) {
        Solution3 solution3 = new Solution3();;
        int[][] indices = {{0, 1}, {1, 1}};
        solution3.oddCells(2, 3, indices);

        Map<Integer, String> map = Collections.unmodifiableMap(new HashMap<>());
    }
    public int oddCells(int m, int n, int[][] indices) {
        int[] rows = new int[m];
        int[] cols = new int[n];
        for (int[] index : indices) {
            rows[index[0]]++;
            cols[index[1]]++;
        }
        int oddx = 0, oddy = 0;
        for (int i = 0; i < m; i++) {
            if ((rows[i] & 1) != 0) {
                oddx++;
            }
        }
        for (int i = 0; i < n; i++) {
            if ((cols[i] & 1) != 0) {
                oddy++;
            }
        }
        return oddx * (n - oddy) + (m - oddx) * oddy;
    }
}
